<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">

    <title>汽保王国后台商家管理系统</title>

    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/animate.min.css">
    <link rel="stylesheet" href="../js/plugins/pace/pace.css">
    <link rel="stylesheet" href="../css/style.min.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/login.css">
    <!--[if lte IE 9]>
    <style type="text/css">
        input, textarea {
            color: #000;
        }

        .placeholder {
            color: #aaa;
        }

        .form-horizontal .control-label {
            padding-top: 0;
        }
    </style>
    <![endif]-->

    <script src="../js/jquery-1.12.4.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/plugins/layer/layer.js"></script>



    <script src="../js/plugins/pace/pace.min.js"></script>
</head>
<body >

<div class="loginscreen">
    <div class="login">
        <!-- <img src="{{cdn('img/logo-login.png')}}" alt=""> -->
        <img src="../img/hd_logo.png" alt="" class="logo">
        <h3> 汽保王国商家后台管理系统</h3>
        <div class="m-t" role="form">
            <div class="form-group">
                <input type="text" name="username" id="username" class="form-control" placeholder="手机" required  autocomplete="off"/>
            </div>
            <div class="form-group">
                <input type="password" name="password" class="form-control" placeholder="密码" required autocomplete="off" id="password"/>
            </div>
            <button type="submit" class="btn btn-primary block full-width m-b" id="login">登 录</button>
        </div>
    </div>
</div>
<!--[if lte IE 9]>
<script src="../js/jquery.placeholder.min.js"></script>
<script type="text/javascript">jQuery('input, textarea').placeholder();</script>
<![endif]-->
<script src="../js/public.js"></script>
<script src="./js/common.js"></script>
<script>

    $(function(){
        $('#login').click(function(){
            var username = $('#username').val();
            if(username==''){
             return   layer.msg('请输入用户名或者手机号')
            }
            var password = $('#password').val();
            if(password==""){
                return layer.msg('请输入密码')
            }
            $.ajax({
                url:base_url+"/api/login",
                data:{
                    phone:username,
                    password:password,
                    type:2,
                    p:"w"
                },
                type:"post",
                success:function(res){
                    console.log(res)
                    if(res.status==1){
                        localStorage.api_token = res.data.api_token;
                        layer.msg('登录成功');
                        setTimeout(function(){
                            window.location.href="./index.html";
                        },500)
                    }else{
                        layer.msg(res.msg);
                    }
                },
                error:function (error) {
                    console.log(error)
                }
            })

        })
    })
</script>

</body>
</html>
